class Cat:
    def __init__(self, name):
        print("构造方法调用了")
        self.name = name

    def __del__(self):
        # 对象销毁时调用
        print("%s去了" % self.name)

    def eat(self):
        print("%s吃鱼" % self.name)


tom = Cat("tom")
tom.eat()
print("--" * 25)
# 程序结束，回收tom对象时会执行_del_方法
